<?php
namespace  App\Http\Controllers\Radius;
use  App\Http\Controllers\Controller;

use App\Order;
use App\Rad_user;
use App\Rad_user_account;
use Illuminate\Http\Request;

use App\Common\ErrorDefine;

use App\Radacct;
use App\Radcheck;
use App\Radgroupcheck;
use App\Radreply;
use App\Radusergroup;
use App\Rad_manage;
use App\Radgroupreply;
use App\Rad_users;
use App\Rad_account;
use App\Rad_merge_data;
use DB;
use App\Rad_manage_discount;
use App\Rad_order;
use App\Line;
use App\Agent;

use App\Manage_user_list;

use Redis;

class ModuleController extends Controller
{

    static function DeleteAccount($manage_id,$level,$id)
    {

        $user = Radcheck::find($id);
        //   退款

        $ret =  Rad_users::find($id);


//        if($level != 2)
//        {
//            if($ret->balance>0)
//            {
//                $manage = Rad_manage::find($manage_id);
//
//                $manage->balance = $manage->balance + $ret->balance;
//                $manage->save();
//            }
//        }


        //  删除用户表信息
        $ret = Radcheck::where('username',$user->username)->delete();
        $ret1 = Radusergroup::where('username',$user->username)->delete();
        $ret2 = Rad_users::where('user_id',$id)->delete();
        $ret3 = Radreply::where('username',$user->username)->delete();
        $ret4 = Manage_user_list::where('username',$user->username)->delete();
    }

}